/**
 * Copyright - Accor - All Rights Reserved www.accorhotels.com
 */
package com.my.imq.batch;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author <a href="MABDELOUHAB">MABDELOUHAB</a>
 * created 18 janv. 2013
 * @since 
 * @version $Id$
 */
public class ImqMetrics
{
    
    private static Logger log = LoggerFactory.getLogger( ImqMetrics.class );
    
    

    public static void main( String args[] )
    {
        log.info( "demarage du contexte" );
        ApplicationContext ctx = new ClassPathXmlApplicationContext("spring/application/applicationContext.xml");
        
        
        
        boolean totals = true;

        for ( int i = 0; i < args.length; ++i )
        {
            if ( args[i].equals( "-m" ) )
            {
                String type = args[i + 1];

                if ( type.equals( "ttl" ) )
                {
                    totals = true;
                }
                else if ( type.equals( "rts" ) )
                {
                    totals = false;
                }
            }
        }
        BrokerMetrics bm = new BrokerMetrics(ctx);

        
        bm.initJMS();
        bm.subscribeToMetric();
        
        
        JvmMetrics jvm = new JvmMetrics(ctx);

        
        jvm.initJMS();
        jvm.subscribeToMetric();
        
        DestinationMetrics dm = new DestinationMetrics(ctx);

        
        dm.initJMS();
        dm.subscribeToMetric();
        
    }

}
